namespace LeanUi.ImageBundle
{
    public class CodeGenerationTemplates
    {
        public const string CssMainSpriteRule_2 =  
            @"img[src$=""null.gif""] {{{{  
    background: transparent url({{0}}) no-repeat scroll 0px 0px; 
    width: {0}px; height: {1}px; 
    margin: 0; padding: 0;
}}}}
";

        public const string CssBgSpriteRule_3 =
            @".{0} {{{{ background: transparent url({1}) scroll {2} 0 0; }}}}";

        public const string CssDisabledBgSpriteRule_3 =
            @"*[disabled] > .{0} {{{{ background: transparent url({1}) scroll {2} 0 0; }}}}";

        public const string CssSpriteRule_4 =
            @"img.{0} {{{{ background-position: {1}px {2}px; {3}{4}}}}}";
        public const string CssDisabledSpriteRule_4 =
            @"*[disabled] > img.{0} {{{{ background-position: {1}px {2}px; {3}{4}}}}}";

        public const string CssWidth_1 = "width: {0}px; ";
        public const string CssHeight_1 = "height: {0}px; ";


//        public const string ClassTemplate =
// @"using LeanUi.ImageBundle;
//
//namespace {0} {{
//
//   public partial class ImageBundle
//   {{
//       public static {1} {2} = new {1}();
//   }}
//
//   public class {1} : ImageBundleBase
//   {{
//       public {1}()
//            : base(""{2}"",""{3}"")
//       {{
//{4}
//
//            this.Rules=@""{5}"";
//       }}
//
//{6}           
//   }}
//}}";


        public const string NamespaceTemplate =
@"using LeanUi.ImageBundle;

namespace {0} {{
{1}
//bundle classes
{2} 
}};
";
        
        public const string ImageBundleClassTemplate =
@"
   public class ImageBundle
   {{
       private const string FullBundleName = ""{0}"";

       // IImageBundle-Singletons e.g. public static FamfamImageBundle Bug = new FamfamImageBundle();
{1}

       public static IImageBundle GetBundle(string key)
       {{
           switch (key)
           {{
               //case ""Famfam"": return Famfam;
{2}
               default: return null;
           }}
       }}

       public static string LinkStylesheet()
       {{
           string stylesheetPath = ImageBundleDirs.CssFile(FullBundleName + "".css"");
           return string.Format(""<link href=\""{{0}}\"" rel=\""stylesheet\"" type=\""text/css\""/>"", stylesheetPath);
       }}

       public static string EmbedStyles(bool renderStyleTags)
       {{
           string spritePath = ImageBundleDirs.ImageFile(FullBundleName + "".png"");
           string css = string.Format(Css, spritePath);
           return (renderStyleTags) ? string.Format(""<style>{{0}}</style>"", css) : css;
       }}

       public const string Css = @""{3}"";
  }};
";
                  
        public const string ClassTemplate =
@"
   public class {0}ImageBundle : IImageBundle
   {{
{1}     

       public ImageSprite Image(string key)
       {{
           switch (key)
           {{
{2}
                default: return null;
           }}
       }}      
   }}
";
        public const string ImageBundleSingletonTemplate = @"       public static {0}ImageBundle {0} = new {0}ImageBundle();";
        public const string PropertyTemplate = @"       public readonly ImageSprite {0} = new ImageSprite(@""{1}"");";
        public const string DynamicAccessTemplate = @"                case ""{0}"": return {0};";
    }
}